import Vue from 'vue'
import Router from 'vue-router'
Vue.use(Router)

export const constantRoutes = [
    // {
    //     path: '/enter',
    //     component:()=>import('@/views/enter')
    // },
    {
        path: '/index',
        component:()=>import('@/views/index')
    },
    {
        path: '/home',
        component:()=>import('@/views/home')
    },
    {
        path: '/contradiction',
        component:()=>import('@/views/contradiction')
    },
    {
        path: '/case',
        component:()=>import('@/views/case')
    },
    {
        path: '/follow',
        component:()=>import('@/views/follow')
    },
    {
        path: '/meeting',
        component:()=>import('@/views/meeting')
    },
    {
        path: '/morality',
        component:()=>import('@/views/morality')
    },
    {
        path: '/building',
        component:()=>import('@/views/building')
    },
    {
        path: '/adjust',
        component:()=>import('@/views/adjust')
    },
    {
        path: '/management',
        component:()=>import('@/views/management')
    },
    {
        path: '/lecture',
        component:()=>import('@/views/lecture')
    },
    {
        path: '/404',
        component: () => import('@/views/error-page/404'),
    },
    {
        path: '/401',
        component: () => import('@/views/error-page/401'),
    },
    { path: '*', redirect: '/404', hidden: true }
]

export const asyncRoutes = [

]

const createRouter = () => new Router({
    scrollBehavior: () => ({ y: 0 }),
    routes: constantRoutes
})

const router = createRouter()

export function resetRouter() {
    const newRouter = createRouter()
    router.matcher = newRouter.matcher // reset router
}

export default router
